/**
  ******************************************************************************
  * @file    bsp_rtc.h
  * @author  Iron
  * @date    2018-07-09
  * @version v1.0
  * @brief   bsp rtc header file
  */

#ifndef __BSP_RTC_H
#define __BSP_RTC_H

#ifdef __cplusplus
extern "C" {
#endif

/* includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <string.h>
#include <time.h>

/* exported types ------------------------------------------------------------*/
/* exported constants --------------------------------------------------------*/
/* exported macro ------------------------------------------------------------*/
#define BSP_RTC_FAIL   0
#define BSP_RTC_OK     1

/* exported functions ------------------------------------------------------- */
void bsp_rtc_init(void);

int32_t bsp_set_rtc_time(time_t sec, time_t us);
int32_t bsp_set_rtc_date_time(int year, int mon, int mday, int hour, int min, int sec, int wday);

time_t bsp_get_rtc_time(struct tm *t, time_t *sec, time_t *us);

struct tm *bsp_rtc_gmtime_r(const time_t *timep, struct tm *r);

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __BSP_RTC_H */

/******************* (C)COPYRIGHT 2018 ***** END OF FILE *********************/
